package com.xunkids.bos.migration.component.transmission.api;



import com.xunkids.bos.migration.common.exception.RushException;
import com.xunkids.bos.migration.component.transmission.pojo.RequestMessage;
import com.xunkids.bos.migration.component.transmission.pojo.ResponseMessage;

import java.util.concurrent.CompletableFuture;

/**
 * 传输层API
 *
 * @author xigexb
 * @version 1.0.0
 * @since 2022/8/26 16:50
 */
public interface TransportApi {

    /**
     * 发送消息
     *
     * @param message 消息
     */
    void sendMessage(RequestMessage message) throws RushException;

    /**
     * 发起请求
     *
     * @param request 请求
     */
    CompletableFuture<ResponseMessage> request(RequestMessage request) throws RushException;

    /**
     * 响应
     *
     * @param response 响应
     */
    void response(ResponseMessage response);

    /**
     * 获取订阅器
     *
     * @return 订阅器
     */
    QueueSubscriber getSubscriber();
}
